package com.ITArmy.controller;


import com.ITArmy.common.ServerResponse;
import com.ITArmy.controller.base.BaseController;
import com.ITArmy.service.TypeService;
import com.ITArmy.util.GetUserSession;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/test")
@Api(value = "测试的接口", tags = "测试接口...")
public class UtilController extends BaseController {
    GetUserSession getUserSession = new GetUserSession();

    @ApiOperation(value = "进入editor编辑器的页面", httpMethod = "POST")
    @RequestMapping("/editor")
    public String testEditor(HttpServletRequest request, Model model) {
        getUserSession.addUserModel(request, model);
        model.addAttribute("type", typeService.typeList().getData());
        return "wangeditor";
    }

    @ApiOperation(value = "测试GitHub登录", httpMethod = "POST")
    @RequestMapping("/git")
    public String goGit() {
        return "GitHubLogin";
    }


    @ApiOperation(value = "测试后台的添加config配置主题", httpMethod = "POST")
    @RequestMapping("/adminConfig")
    public String adminConfig() {
        return "upload";
    }

    @RequestMapping("/testJs")

    public String testJs() {
        return "wangfukun";
    }

}
